<?php
class ParametreController extends Zend_Controller_Action
{
	
	
    
     public function connexionAction() {
    	
		$form = new Form_Connexion();
		$_SESSION['admin']=false;
		$this->view->form = $form;
		$parametres = new Table_Parametres();
		
		$login = ($parametres->getAllLogin());
		$mdp = ($parametres->getPasswd());
		
		$resu = $this-> getRequest()->getPost();			
		
		$valeurs = $form->getValues();
		if(isset($resu["login"])){
			foreach($login as $log){
				if($resu["login"]==$log->LOGIN && hash('sha256',$resu["pass"])== $mdp->PASSWD)
					{
						$_SESSION['admin']=true;
														
						sleep(2);
						$this -> redirect ('/');
					}	
				else{
					echo "Erreur, vérifiez vos identifiants.";
				}
		 }
		}
		 			
	}

}
?>